﻿<UserControl x:Class="MediaAssistant.Controls.AlternativeLocation.AlternativeLocationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Behavior="clr-namespace:MefBasic.Behaviors;assembly=MefBasic" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Width="700" Height="500">
    <DockPanel>
        <Border DockPanel.Dock="Top" Background="#ECECEC">
            <DockPanel>
                <TextBlock DockPanel.Dock="Top" Text="Edit title to create new movie. The new movie will be submited as a pending movie to process." Margin="5,10"/>
                <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Left" Orientation="Horizontal" Height="30" Margin="0,10">
                    <Button  Width="30" Height="30" 
                             Command="{Binding DataSource.PlayMovieCommand}" 
                             CommandParameter="{Binding SelectedMovie}"
                             ToolTip="Play movie with default player"
                             Style="{StaticResource ImageButtonStyle}">
                        <ContentControl Content="{StaticResource PlayMovieImage}"/>
                    </Button>
                    <Button  Width="30" Height="30" Margin="10,0" ToolTip="Show movie in windows explorer"
                             Command="{Binding DataSource.ShowMovieInWindowsExplorerCommand}"
                             CommandParameter="{Binding SelectedMovie}"
                             Style="{StaticResource ImageButtonStyle}">
                        <ContentControl Content="{StaticResource MovieFolderImage}"/>
                    </Button>
                    <Button  Width="30" Height="30" ToolTip="Swap with default location"
                             Command="{Binding MakeDefaultLocationCommand}"
                             CommandParameter="{Binding SelectedMovie}"
                             Style="{StaticResource ImageButtonStyle}">
                        <ContentControl Content="{StaticResource DefaultImage}"/>
                    </Button>
                </StackPanel>
            </DockPanel>
            
        </Border>
        <DataGrid Name="Grid" HorizontalAlignment="Stretch" DockPanel.Dock="Top"
         CanUserAddRows="False"
         CanUserDeleteRows="False"
         CanUserSortColumns="True"
         AutoGenerateColumns="False"
         AlternatingRowBackground="{StaticResource AlternatingRowBackground}"
         RowBackground="{StaticResource RowBackground}"
         RowHeight="25"
         HorizontalGridLinesBrush="{StaticResource GridLineBrush}"
         VerticalGridLinesBrush="{StaticResource GridLineBrush}"
         ItemsSource="{Binding AlternativeMovies}"
         SelectionMode="Single"
         VirtualizingStackPanel.IsVirtualizing="True"
         VirtualizingStackPanel.VirtualizationMode="Recycling"
         EnableRowVirtualization="True"
            VerticalScrollBarVisibility="Auto"
            HorizontalScrollBarVisibility="Auto"
         Behavior:SelectionBehavior.SelectionChanged="{Binding SelectedMovieChangedCommand}"
          >
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Play" 
                              Command="{Binding DataSource.PlayMovieCommand}"
                              CommandParameter="{Binding SelectedMovie}"/>
                    <Separator/>
                    <MenuItem Header="Show in Windows Explorer" 
                              Command="{Binding DataSource.ShowMovieInWindowsExplorerCommand}"
                              CommandParameter="{Binding SelectedMovie}"/>
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="" Width="45" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <TextBlock Name="textBlock" DockPanel.Dock="Left" TextAlignment="Right" Width="25" Text="{Binding Index}"/>
                            </DockPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="File Name" Width="200" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Name="textBlock" Text="{Binding Path=FileName}" FontWeight="Normal" ToolTip="{Binding FullPath}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Title" Width="200">
                    <DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Title}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellEditingTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Name="textBlock" Text="{Binding Title}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Size" Width="80" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Name="textBlock" Text="{Binding SizeText}" TextAlignment="Right"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</UserControl>
